import {configureStore} from "@reduxjs/toolkit";

// import accountSlice from "./accountSlice";
import { 
    persistStore,
    FLUSH,
    REHYDRATE,
    PAUSE,
    PERSIST,
    PURGE,
    REGISTER
} from 'redux-persist'; // 导入上面配置的持久化根 reducer

import rootReducer from './rootReducer'

const store = configureStore({
    // reducer:{
    //     accountGroup:accountSlice
    // },
    reducer:rootReducer,
    middleware: (getDefaultMiddleware) =>
        getDefaultMiddleware({
            serializableCheck: {
                // 忽略 action 中的 type
                ignoredActions: ['userSclic/changMenu','account_slice/updateRoute',FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
                // 忽略 action 中的指定字段({action,payload} 中的所有指定的路径)
                ignoredActionPaths: ['meta.arg', 'payload.timestamp'],
                // 忽略 state 中的路径(属性)
                ignoredPaths: ['userSclice.userMenu','accountGroup.publicRoutes','accountGroup.privateRoutes'],
            },
        }),
})

const persistor = persistStore(store);
export { store, persistor };
// export default store;